import crissyService from "..";
import serverConfig from "../config";

export const getVideoPageAPI = (data) => {
    return crissyService({
        method: "post",
        url: "/video/login",
        baseURL: serverConfig.videoServer,
        data,
    })
};

export const getVideoPageListAPI = (data) => {
    return crissyService({
        method: "post",
        url: "/video/feed",
        baseURL: serverConfig.videoServer,
        data,
        headers: { "Content-Type": "application/json" }
    })
}

export const getVideoByIdAPI = (id) => {
    return crissyService({
        method: "get",
        url: `/video/getVideoByUserId/${id}`,
        baseURL: serverConfig.videoServer,
    })
}

export const getVideoRandomAPI = () => {
    return crissyService({
        method: "get",
        url: `/video/getRecommendVideo/1`,
        baseURL: serverConfig.videoServer,
    })
}

const videoNum = 20;
export const searchByKeywordAPI = (keyword) => {
    return crissyService({
        method: "get",
        url: `/video/searchVideoPage/${keyword}/${videoNum}`,
        baseURL: serverConfig.videoServer,
    })
}

export const getVideoListByUserIdAPI = (userId) => {
    return crissyService({
        method: "get",
        url: `/video/getVideoListByUserId/${userId}`,
        baseURL: serverConfig.videoServer,
    })
};

// export const publishVideoAPI = (data) => {
//     return crissyService({
//         method: "post",
//         url: '/video/publishVideo',
//         baseURL: serverConfig.videoServer,
//         data,
//         headers: { "Content-Type": "application/json" }
//     })
// }